﻿<%@ Page Language="C#" AutoEventWireup="true" Codebehind="ListPersonalProject.aspx.cs"
    Inherits="LabMS.Web.PersonalProjectManagement.ListPersonalProject" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>学生自拟开放实验申请列表</title>
    <link type="text/css" rel="stylesheet" href="../style/screen.css" />
    <!--[if lte IE 6]>
    <link type="text/css" rel="stylesheet" href="../style/ie6.css" />
    <![endif]-->
    <!--[if lte IE 7]>
    <link type="text/css" rel="stylesheet" href="../style/ie7.css" />
    <![endif]-->

    <script src="../../js/Common.js" type="text/javascript"></script>

</head>
<body class="mainBody">
    <form id="form1" runat="server">
        <div class="main">
            <div id="pageInfo" class="clearfix">
                <div class="title">
                    <label>
                        学生自拟开放实验申请列表</label>
                </div>
            </div>
        </div>
        <div class="main">
            <p>
                <%--<asp:CheckBox ID="checkall" runat="server" Font-Size="9pt" Text="全选" />--%>
                <asp:Button ID="btnDelete" runat="server" OnClick="btnDelete_Click" Text="删除" CssClass="button" />
            </p>
            <p>
                <table cellpadding="5" cellspacing="0" border="0">
                    <tr>
                        <td>
                            项目名称：
                        </td>
                        <td>
                            <asp:TextBox ID="tbProjectName" runat="server" />
                        </td>
                        <td>
                            计划时数：
                        </td>
                        <td>
                            <asp:TextBox ID="tbPlanHours" runat="server" />
                        </td>
                        <td>
                            实验室：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlLab" DataTextField="Lab_Name" DataValueField="Lab_Code"
                                runat="server" />
                        </td>
                        <td>
                            联系人：
                        </td>
                        <td>
                            <asp:TextBox ID="tbContactor" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            指导老师：
                        </td>
                        <td>
                            <asp:TextBox ID="tbTeacher" runat="server" />
                        </td>
                        <td>
                            审批状态：
                        </td>
                        <td>
                            <asp:DropDownList ID="ddlProjectStatus" DataTextField="Name" DataValueField="Code"
                                runat="server" />
                        </td>
                        <td>
                            审批人：
                        </td>
                        <td>
                            <asp:TextBox ID="tbApproval" runat="server" />
                        </td>
                        <td>
                        </td>
                        <td>
                            <asp:Button ID="btSearch" runat="server" Text="搜索" OnClick="btSearch_Click" CssClass="button" />
                        </td>
                    </tr>
                </table>
            </p>
        </div>
        <div class="main">
            <asp:GridView ID="gvPersonalProjectList" runat="server" AutoGenerateColumns="false"
                AllowPaging="true" Width="100%" PageSize="15" DataKeyNames="ProjectID" OnPageIndexChanging="GridViewPerProject_PageIndexChanging"
                OnRowDataBound="GridViewPerProject_RowDataBound" CssClass="infoTable">
                <Columns>
                    <asp:TemplateField ItemStyle-CssClass="checkBox">
                        <HeaderTemplate>
                            <asp:CheckBox ID="CBAll" runat="server" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox ID="ProjectCB" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField HeaderText="项目名称" DataField="ProjectName" />
                    <asp:BoundField HeaderText="计划时数" DataField="PlanHours" />
                    <asp:BoundField HeaderText="申请时间" DataField="ApplicationTime" />
                    <asp:BoundField HeaderText="申请实验室 " DataField="LabName" />
                    <asp:BoundField HeaderText="联系人" DataField="Contactor" />
                    <asp:BoundField HeaderText="指导老师" DataField="Teacher" />
                    <asp:BoundField HeaderText="状态" DataField="ProjectStatusName" />
                    <asp:BoundField HeaderText="审批人" DataField="Approval" />
                </Columns>
                <HeaderStyle CssClass="header" />
                <EmptyDataTemplate>
                    没有数据！
                </EmptyDataTemplate>
            </asp:GridView>
        </div>
    </form>

    <script type="text/javascript" src="../../js/jQuery/jquery-1.3.1.js"></script>

    <script type="text/javascript" src="../../js/site.js"></script>

    <script type="text/javascript">

        $(function(){
            /* 修改样式 */
            $("#gvPersonalProjectList > tbody > tr:even").not(":first").addClass("even");
            $("#gvPersonalProjectList > tbody > tr").not(":first")
                .hover(
                    function(){
                        $(this).addClass("hover");
                    },
                    function(){
                        $(this).removeClass("hover");
                });

            /* 全选 */
            $("#gvPersonalProjectList > tbody > tr:first :checkbox").click(function(){
                if ($(this).attr("checked")){
                    $("#gvPersonalProjectList :checkbox").attr("checked", "checked");
                    cbChanged();
                } else{
                    $("#gvPersonalProjectList :checkbox").attr("checked", "");
                    cbChanged();
                }
            });

            /* Checkbox事件 */
            $("#gvPersonalProjectList :checkbox").not(":first").click(cbChanged);

            cbChanged();
        });

        /* 检测Checkbox的选择状态，更改button的disabled属性 */
        function cbChanged(){
            var hasChecked = false;
            var allChecked = true;
            $("#gvPersonalProjectList :checkbox").not(":first").each(function(index, domEle){
                var curChecked = $(domEle).attr("checked");
                if (!hasChecked && curChecked){
                    hasChecked = true;
                }

                allChecked &= curChecked;
            });

            if (hasChecked){
                $("#btnDelete").attr("disabled", "");
            } else {
                $("#btnDelete").attr("disabled", "disabled");
            }

            if (allChecked){
                $("#gvPersonalProjectList :checkbox").filter(":first").attr("checked", "checked");
            } else {
                $("#gvPersonalProjectList :checkbox").filter(":first").attr("checked", "");
            }
        }
    </script>

</body>
</html>
